#ifndef QPAINTERDRAWABLE_H
#define QPAINTERDRAWABLE_H

#include <QWidget>
#include <QMutex>
#include <QActionGroup>
#include <QTimer>
#include <QMenu>
//#include "mediabase.h"
//#include "imagescaler.h"
#include <QMouseEvent>

namespace Ui {
class QPainterDrawable;
}

class QPainterDrawable : public QWidget
{
    Q_OBJECT

public:
    explicit QPainterDrawable(QWidget *parent = 0);
    ~QPainterDrawable();

    bool Init();
    bool ConnectSignalSlots();

    OnPlay(QString strFile);
    void mouseDoubleClickEvent(QMouseEvent *e);


signals:
    void SigPlayOrPause();
//    void SigOpenFile(QString strFileName);///< 增加视频文件
    void SigPlay(QString strFile); ///<播放

private:
    Ui::QPainterDrawable *ui;

    QTimer timerShowCursor;

    QMenu m_stMenu;

    int x_ = 0; //  起始位置
    int y_ = 0;
    int video_width = 0;
    int video_height = 0;
    int img_width = 0;
    int img_height = 0;

    QImage img;
    QMutex m_mutex;

protected:
    void paintEvent(QPaintEvent *) override;
};

#endif // QPAINTERDRAWABLE_H
